{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fixed-techno",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[\"a\", \"b\"].index(\"a\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "lined-personality",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/find-smallest-letter-greater-than-target/\n",
    "\n",
    "Runtime: 124 ms, faster than 18.35% of Python3 online submissions for Find Smallest Letter Greater Than Target.\n",
    "Memory Usage: 14.6 MB, less than 20.19% of Python3 online submissions for Find Smallest Letter Greater Than Target.\n",
    "\n",
    "\n",
    "```python\n",
    "import string\n",
    "\n",
    "class Solution:\n",
    "    def nextGreatestLetter(self, letters: List[str], target: str) -> str:\n",
    "        #7:21\n",
    "        abc = list(string.ascii_lowercase)\n",
    "        target_index = abc.index(target)\n",
    "        abc2 = abc[target_index:]\n",
    "        #print(abc2)\n",
    "        letters = list(letters)\n",
    "        def func(c):\n",
    "            if c in abc2: \n",
    "                return abc2.index(c)\n",
    "            else:\n",
    "                return 99999\n",
    "        letters.sort(key=func)\n",
    "        for c in letters:\n",
    "            if c != target:\n",
    "                return c\n",
    "        #7:34\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "unnecessary-pension",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
